#pragma once

template<class Lock>
class AutoLock
{
public:
	AutoLock(Lock& lock)
		:m_lock(lock)
	{
		m_lock.Lock();
	}
	~AutoLock()
	{
		m_lock.Unlock();
	}
private:
	Lock& m_lock;
};

typedef AutoLock<CCriticalSection>  AutoCSLock;